// 路由表
import { createBrowserRouter, Navigate } from "react-router-dom";
import React from "react";

import App from "../App";
import Login from "../components/login/Login";

import PrivateRoute from "@/components/PrivateRoute";

import Distribution from "../components/wrj/distribution/WrjDistribution";
import Management from "@/components/wrj/management/WrjManagement";
import Map from '../components/wrj/map/Map'
import StandingAdd from "@/components/wrj/standingShow/StandingShow";
import Scheduling from "../components/lzs/sheduling/Sheduling";
import Schedulingadd from "../components/lzs/shedulingadd/shedulingadd";
import Home from "../components/home/Home";
import Operation from "../components/wrj/operation/WrjOperation";
import OrderManagement from "@/components/lmx/OrderManagement";
import DeliveryOrder from "@/components/lmx/DeliveryOrder";
// 配送异常
import DeliveryException from "@/components/lmx/DeliveryException";
import Personal from "@/components/wrj/personal/Personal";
import { useSelector } from "react-redux";
import AuthRouter from "@/components/AuthRouter";
// const authList=useSelector((store:any)=>store.counter.sidebarList)
// const authList=useSelector((store:any)=>store.counter.sidebarList)

const router = createBrowserRouter([
  {
    path: "/app",
    element: <AuthRouter><App></App></AuthRouter>,
    // <PrivateRoute allowedPermissions=authList><App></App></PrivateRoute>,
    children: [
      {
        path: "/app/home",
        element: <Home></Home>,
      },
      //刘子硕的路由
      {
        path: "/app/scheduling",
        element: <Scheduling></Scheduling>
      },
      {
        path: "/app/shedulingadd",
        element: <Schedulingadd></Schedulingadd>
      },
      //王瑞锦的路由
      {
        path: "/app/operation",
        element: <Operation></Operation>,
      },
      {
        path: "/app/distribution",
        element: <Distribution></Distribution>
      },
      {
        path: "/app/management",
        element: <Management></Management>
      },
      {
        path: "/app/personal",
        element: <Personal></Personal>
      },
      {
        path: "/app/standingAdd",
        element: <StandingAdd></StandingAdd>
      },
      //李孟玺的路由
      {
        path: "/app/ordermanagement",
        element: <OrderManagement></OrderManagement>,
        children: [
          {
            path: "/app/ordermanagement/deliveryorder",
            element: <DeliveryOrder></DeliveryOrder>,
            children: [
              {
                path: "/app/ordermanagement/deliveryorder/deliveryexception",
                element: <DeliveryException></DeliveryException>,
              },
            ],
          },
        ],
      },
    ],
  },

  {
    path: "login",
    element: <Login></Login>
  },
  {
    path: "/",
    element: <Navigate to="/login"></Navigate>
  }
]);





export default router;
